home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / MachineExceptions.p < prev    next >
Text File  |  1996-05-01  |  6KB  |  214 lines

  1. {
  2.      File:        MachineExceptions.p
  3.  
  4.      Contains:    Processor Exception Handling Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT MachineExceptions;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __MACHINEEXCEPTIONS__}
  28. {$SETC __MACHINEEXCEPTIONS__ := 1}
  29.  
  30. {$I+}
  31. {$SETC MachineExceptionsIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37.  
  38. {$PUSH}
  39. {$ALIGN POWER}
  40. {$LibExport+}
  41.  
  42. {$IFC FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE }
  43. {  Some basic declarations used throughout the kernel  }
  44.  
  45. TYPE
  46.     AreaID = ^LONGINT;
  47. {  Machine Dependent types for PowerPC:  }
  48.     MachineInformationPowerPCPtr = ^MachineInformationPowerPC;
  49.     MachineInformationPowerPC = RECORD
  50.         CTR:                    UnsignedWide;
  51.         LR:                        UnsignedWide;
  52.         PC:                        UnsignedWide;
  53.         CR:                        LONGINT;
  54.         XER:                    LONGINT;
  55.         MSR:                    LONGINT;
  56.         MQ:                        LONGINT;
  57.         ExceptKind:                LONGINT;
  58.         DSISR:                    LONGINT;
  59.         DAR:                    UnsignedWide;
  60.         Reserved:                UnsignedWide;
  61.     END;
  62.  
  63.     RegisterInformationPowerPCPtr = ^RegisterInformationPowerPC;
  64.     RegisterInformationPowerPC = RECORD
  65.         R0:                        UnsignedWide;
  66.         R1:                        UnsignedWide;
  67.         R2:                        UnsignedWide;
  68.         R3:                        UnsignedWide;
  69.         R4:                        UnsignedWide;
  70.         R5:                        UnsignedWide;
  71.         R6:                        UnsignedWide;
  72.         R7:                        UnsignedWide;
  73.         R8:                        UnsignedWide;
  74.         R9:                        UnsignedWide;
  75.         R10:                    UnsignedWide;
  76.         R11:                    UnsignedWide;
  77.         R12:                    UnsignedWide;
  78.         R13:                    UnsignedWide;
  79.         R14:                    UnsignedWide;
  80.         R15:                    UnsignedWide;
  81.         R16:                    UnsignedWide;
  82.         R17:                    UnsignedWide;
  83.         R18:                    UnsignedWide;
  84.         R19:                    UnsignedWide;
  85.         R20:                    UnsignedWide;
  86.         R21:                    UnsignedWide;
  87.         R22:                    UnsignedWide;
  88.         R23:                    UnsignedWide;
  89.         R24:                    UnsignedWide;
  90.         R25:                    UnsignedWide;
  91.         R26:                    UnsignedWide;
  92.         R27:                    UnsignedWide;
  93.         R28:                    UnsignedWide;
  94.         R29:                    UnsignedWide;
  95.         R30:                    UnsignedWide;
  96.         R31:                    UnsignedWide;
  97.     END;
  98.  
  99.     FPUInformationPowerPCPtr = ^FPUInformationPowerPC;
  100.     FPUInformationPowerPC = RECORD
  101.         Registers:                ARRAY [0..31] OF UnsignedWide;
  102.         FPSCR:                    LONGINT;
  103.         Reserved:                LONGINT;
  104.     END;
  105.  
  106. {  Exception related declarations  }
  107.  
  108. CONST
  109.     kWriteReference                = 0;
  110.     kReadReference                = 1;
  111.     kFetchReference                = 2;
  112.     writeReference                = 0;                            {  Obsolete name }
  113.     readReference                = 1;                            {  Obsolete name }
  114.     fetchReference                = 2;                            {  Obsolete name }
  115.  
  116.  
  117. TYPE
  118.     MemoryReferenceKind                    = LONGINT;
  119.     MemoryExceptionInformationPtr = ^MemoryExceptionInformation;
  120.     MemoryExceptionInformation = RECORD
  121.         theArea:                AreaID;
  122.         theAddress:                LogicalAddress;
  123.         theError:                OSStatus;
  124.         theReference:            MemoryReferenceKind;
  125.     END;
  126.  
  127.  
  128. CONST
  129.     kUnknownException            = 0;
  130.     kIllegalInstructionException = 1;
  131.     kTrapException                = 2;
  132.     kAccessException            = 3;
  133.     kUnmappedMemoryException    = 4;
  134.     kExcludedMemoryException    = 5;
  135.     kReadOnlyMemoryException    = 6;
  136.     kUnresolvablePageFaultException = 7;
  137.     kPrivilegeViolationException = 8;
  138.     kTraceException                = 9;
  139.     kInstructionBreakpointException = 10;
  140.     kDataBreakpointException    = 11;
  141.     kIntegerException            = 12;
  142.     kFloatingPointException        = 13;
  143.     kStackOverflowException        = 14;
  144.     kTaskTerminationException    = 15;
  145.     kTaskCreationException        = 16;
  146.  
  147. {$IFC OLDROUTINENAMES }
  148.     unknownException            = 0;                            {  Obsolete name }
  149.     illegalInstructionException    = 1;                            {  Obsolete name }
  150.     trapException                = 2;                            {  Obsolete name }
  151.     accessException                = 3;                            {  Obsolete name }
  152.     unmappedMemoryException        = 4;                            {  Obsolete name }
  153.     excludedMemoryException        = 5;                            {  Obsolete name }
  154.     readOnlyMemoryException        = 6;                            {  Obsolete name }
  155.     unresolvablePageFaultException = 7;                            {  Obsolete name }
  156.     privilegeViolationException    = 8;                            {  Obsolete name }
  157.     traceException                = 9;                            {  Obsolete name }
  158.     instructionBreakpointException = 10;                        {  Obsolete name }
  159.     dataBreakpointException        = 11;                            {  Obsolete name }
  160.     integerException            = 12;                            {  Obsolete name }
  161.     floatingPointException        = 13;                            {  Obsolete name }
  162.     stackOverflowException        = 14;                            {  Obsolete name }
  163.     terminationException        = 15;                            {  Obsolete name }
  164.     kTerminationException        = 15;                            {  Obsolete name }
  165.  
  166. {$ENDC}
  167.  
  168. TYPE
  169.     ExceptionKind                        = LONGINT;
  170.     ExceptionInfoPtr = ^ExceptionInfo;
  171.     ExceptionInfo = RECORD
  172.         CASE INTEGER OF
  173.         0: (
  174.             memoryInfo:            MemoryExceptionInformationPtr;
  175.             );
  176.     END;
  177.  
  178.     ExceptionInformationPowerPCPtr = ^ExceptionInformationPowerPC;
  179.     ExceptionInformationPowerPC = RECORD
  180.         theKind:                ExceptionKind;
  181.         machineState:            MachineInformationPowerPCPtr;
  182.         registerImage:            RegisterInformationPowerPCPtr;
  183.         FPUImage:                FPUInformationPowerPCPtr;
  184.         info:                    ExceptionInfo;
  185.     END;
  186.  
  187.     ExceptionInformation                = ExceptionInformationPowerPC;
  188.     ExceptionInformationPtr             = ^ExceptionInformation;
  189.     MachineInformation                    = MachineInformationPowerPC;
  190.     MachineInformationPtr                 = ^MachineInformation;
  191.     RegisterInformation                    = RegisterInformationPowerPC;
  192.     RegisterInformationPtr                 = ^RegisterInformation;
  193.     FPUInformation                        = FPUInformationPowerPC;
  194.     FPUInformationPtr                     = ^FPUInformation;
  195. {
  196.  Note:    An ExceptionHandler is NOT a UniversalProcPtr.
  197.             It must be a PowerPC function pointer with NO routine descriptor. 
  198. }
  199.     ExceptionHandler = ProcPtr;  { FUNCTION ExceptionHandler(VAR theException: ExceptionInformationPowerPC; refcon: UNIV Ptr): OSStatus; C; }
  200.  
  201. {  Routine for installing per-process exception handlers  }
  202. FUNCTION InstallExceptionHandler(theHandler: ExceptionHandler; refcon: UNIV Ptr): ExceptionHandler;
  203. {$ENDC}
  204. {$ALIGN RESET}
  205. {$POP}
  206.  
  207. {$SETC UsingIncludes := MachineExceptionsIncludes}
  208.  
  209. {$ENDC} {__MACHINEEXCEPTIONS__}
  210.  
  211. {$IFC NOT UsingIncludes}
  212.  END.
  213. {$ENDC}
  214.